export default {
  data() {
    return {
      countdown: 5,
      redirectUrl: ''
    }
  },
  methods: {
    handleCountdownTimer() {
      if (this.countdown > 1) {
        this.countdown--
        setTimeout(this.handleCountdownTimer, 1000)
      } else {
        this.$router.push(this.redirectUrl)
      }
    }
  },
  mounted() {
    setTimeout(this.handleCountdownTimer, 1000)
  },
  beforeDestroy() {
    this.countdownTimer && clearTimeout(this.countdownTimer)
  }
}
